var events = require("events");
var Emitter = events.EventEmitter;

function Dog(dogName) {
    Emitter.call(this); //this当前实例化的dog对象; 实现对EventEmitter继承
    this.dogName = dogName;
}
Dog.prototype = Emitter.prototype; //实现对EventEmitter继承
Dog.prototype.bark = function(){
    console.log(this.dogName + " barked");
}

module.exports = Dog; //将Dog构造函数对外公布